package com.sreader.sreader4j;

//import com.google.gwt.user.client.ui.Button;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import com.vaadin.terminal.ThemeResource;
import com.vaadin.ui.AbsoluteLayout;
import com.vaadin.ui.AbstractTextField;
import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
import com.vaadin.ui.Component;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Label;
import com.vaadin.ui.MenuBar;
import com.vaadin.ui.Window;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TextField;
import com.vaadin.ui.Form;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.themes.BaseTheme;
import com.vaadin.data.Validator;
import com.vaadin.data.validator.*;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeListener;

public class FeuilleDeCalcul extends CustomComponent implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Window mainWindow;
	private final String LOCALEBASE = "FeuilleDeCalcul";
	private final String LOCALEPROPSTRING = "properties";
	private AbsoluteLayout mainLayout;
	private AbsoluteLayout formAbsoluteLayout;
	private Panel mainPanel;
	private AbsoluteLayout mainPanelAbsoluteLayout;
	private Form feuilleForm;
	private TextField name_15;
	private TextField name_14;
	private TextField name_13;
	private TextField name_12;
	private TextField name_11;
	private TextField name_10;
	private TextField name_9;
	private TextField name_8;
	private TextField name_7;
	private TextField name_6;
	private TextField name_5;
	private TextField name_4;
	private TextField name_3;
	private TextField name_2;
	private TextField name_1;
	private Label     nameLabel;
	private TextField vorname_15;
	private TextField vorname_14;
	private TextField vorname_13;
	private TextField vorname_12;
	private TextField vorname_11;
	private TextField vorname_10;
	private TextField vorname_9;
	private TextField vorname_8;
	private TextField vorname_7;
	private TextField vorname_6;
	private TextField vorname_5;
	private TextField vorname_4;
	private TextField vorname_3;
	private TextField vorname_2;
	private TextField vorname_1;
	private Label     vornameLabel;
	private TextField day_1;
	private TextField day_2;
	private TextField month_1;
	private TextField month_2;
	private TextField year_1;
	private TextField year_2;
	private TextField year_3;
	private TextField year_4;
	private Label occurenceTableCaption;
	private Label horizontalBar;
	private Label dateLabel;
	private Locale currentLocaleValue;
	private Validator letterEntryValidator;
	private Validator numericEntryValidator;
	private ClickListener sendButtonListener;
	private ClickListener discardButtonListner;
	private TextChangeListener nameEntryListener;
	private PersonBean individum;
	private FeuilleDeResultat feuilleDeResultat;
	private FeuilleDeConfiguration feuilleDeConfiguration;
	private Button moreButton;
	private Button mailButton;
	private ClickListener moreButtonListener;
	private Button printerButton;
	private ClickListener printButtonListener;
	private Button sendButton;
	private Button discardButton;
	private Embedded faceBookButton;
	private MenuBar menubar;
	private OccurenceTableUI occurenceTableUI;
	private String languageCode;
	private Messages messages;

	/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */

	/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */

	/**
	 * The constructor should first build the main layout, set the
	 * composition root and then do any custom initialization.
	 *
	 * The constructor will not be automatically regenerated by the
	 * visual editor.
	 */
	public FeuilleDeCalcul(Locale defaultLocale,Window main) {
		mainWindow = main;
		setCurrentLocaleValue(defaultLocale);
		setMessages(new Messages("FeuilleDeCalcul",defaultLocale));
		buildMainLayout();
		setCompositionRoot(mainLayout);
		vorname_1.setCursorPosition(0);
		individum = new PersonBean();
		
	}


	private Locale getCurrentLocaleValue() {
		
		return currentLocaleValue;
	}


	private void setCurrentLocaleValue(Locale currentLocaleValue) {
		this.currentLocaleValue = currentLocaleValue;
		//get the current language. will be used for choosing appropriate 
		//VOYELLES Constant
		setLanguageCode(currentLocaleValue.getLanguage());

	}


	public Messages getMessages() {
		return messages;
	}


	public void setMessages(Messages messages) {
		this.messages = messages;
	}

	public String getLanguageCode() {
		return languageCode;
	}


	public void setLanguageCode(String languageCode) {
		this.languageCode = languageCode;
	}


	private AbsoluteLayout buildMainLayout() {
		//System.out.println( "Defaultlang is: " + getCurrentLocaleValue() );
		// common part: create layout
		mainLayout = new AbsoluteLayout();
		mainLayout.setCaption(this.messages.getString("feuilleDesc"));
		mainLayout.setImmediate(false);
		mainLayout.setWidth("725.0px"); 
		mainLayout.setHeight("920.0px"); 
		mainLayout.setMargin(false);
		
		// top-level component properties
		setWidth("750.0px"); 
		setHeight("950.0px");
		
		//ApplicationMenuBar applicationMenuBar = new ApplicationMenuBar(getCurrentLocaleValue());
		
		//menubar =  applicationMenuBar.getApplicationMenuBar();
			
		//options.addItem(caption, command)
		//mainLayout.addComponent(menubar);
		
		
		//horizontal bar
		HorizontalBar menuHorizontalBar = new HorizontalBar();
		menuHorizontalBar.setStyleName();
		menuHorizontalBar.setWidth("650.0px");
		mainLayout.addComponent(menuHorizontalBar, "top:23.0px;left:0.0px;");
		// mainPanel
		mainPanel = buildMainPanel();

		mainLayout.addComponent(mainPanel, "top:25.0px;left:0.0px;"); //$NON-NLS-1$
		
		return mainLayout;
	}

	public Panel buildMainPanel() {
		// common part: create layout
		mainPanel = new Panel(this.messages.getString("feuilleCaption"));
		mainPanel.setImmediate(false);
		mainPanel.setWidth("650.0px"); //720.0
		mainPanel.setHeight("320px"); //900.0
		
		// mainPanelAbsoluteLayout
		mainPanelAbsoluteLayout = buildMainPanelAbsoluteLayout();
		mainPanel.setContent(mainPanelAbsoluteLayout);
		
		return mainPanel;
	}
	private AbsoluteLayout buildMainPanelAbsoluteLayout() {
		feuilleForm = buildFeuilleForm();
		// common part: create layout
		mainPanelAbsoluteLayout = new AbsoluteLayout();
		mainPanelAbsoluteLayout.setImmediate(true);
	
		
		mainPanelAbsoluteLayout.setWidth("645.0px"); //715.0
		mainPanelAbsoluteLayout.setHeight("300.0px"); //870.0
		mainPanelAbsoluteLayout.setMargin(false);
		
		mainPanelAbsoluteLayout.addComponent(feuilleForm);
		
		return mainPanelAbsoluteLayout;
	}

	
	public Form buildFeuilleForm(){
		//common part. create layout
		feuilleForm = new Form();
		//feuilleForm.setCaption(Messages.getString("FeuilleDeCalcul"+ getCurrentLocaleValue()+".properties.feuilleCaption")); //$NON-NLS-1$
		feuilleForm.setDescription(this.messages.getString("feuilleDescription"));
		feuilleForm.setImmediate(true);
		feuilleForm.setWidth("630.0px"); //710.0
		feuilleForm.setHeight("250px"); //860.0
		//feuilleForm.setWriteThrough(false);
		
		
		//formAbsoluteLayout
		formAbsoluteLayout = buildFormAbsoluteLayout();
	
		
		feuilleForm.setLayout(formAbsoluteLayout);
		
		return feuilleForm;
	}
	
	private AbsoluteLayout buildFormAbsoluteLayout(){
		formAbsoluteLayout = new AbsoluteLayout();
		formAbsoluteLayout.setImmediate(true);
		formAbsoluteLayout.setWidth("620.0px"); //700.0
		formAbsoluteLayout.setHeight("230px"); //840.0$NON-NLS-1$
		formAbsoluteLayout.setMargin(false);
		feuilleDeResultat = new FeuilleDeResultat(getCurrentLocaleValue(),mainWindow);
		
		//feuilleDeConfiguration = new FeuilleDeConfiguration(getCurrentLocaleValue());
	
		//letterEntryValidator
		letterEntryValidator = new RegexpValidator("[a-zA-ZäöüßÄÖÜ]", this.messages.getString("letterValidator")); //$NON-NLS-1$ //$NON-NLS-2$
		//numericEntryValidator
		numericEntryValidator = new RegexpValidator("[0-9]",this.messages.getString("digitValidator")); //$NON-NLS-1$ //$NON-NLS-2$
		nameEntryListener = new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = -4922760103034865110L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				AbstractTextField source = (AbstractTextField) event.getSource();
				if(event.getText().length()>0){
					System.out.println("-" + source.getTabIndex() + "--" + event.getText());
					
				}else{
					System.out.println("_ _");
				}
				
			}
		};
		
		//vornameLabel
		vornameLabel = new Label();
		vornameLabel.setCaption(this.messages.getString("firstname")); //$NON-NLS-1$
		vornameLabel.setWidth("15px"); //$NON-NLS-1$
		formAbsoluteLayout.addComponent(vornameLabel, 
				"top:50.0px;left:10.0px;"); //$NON-NLS-1$
		// vorname_1
		vorname_1 = new TextField();
		//vorname_1.setCaption("Prénom");
		vorname_1.setImmediate(true);
		vorname_1.setWidth("32px"); //$NON-NLS-1$
		vorname_1.setHeight("-1px"); //$NON-NLS-1$
		vorname_1.setTabIndex(1);
		vorname_1.setMaxLength(1);
		vorname_1.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_1.addListener(new TextChangeListener() {


			/**
			 * 
			 */
			private static final long serialVersionUID = -2768316132190135628L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				//AbstractTextField source = (AbstractTextField) event.getSource();
				if(event.getText().length()>0){
					vorname_2.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});

		vorname_1.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_1,
				"top:35.0px;left:87.0px;"); //$NON-NLS-1$
		//nameEntryListener = new ListenerMethod(new Event(vorname_1), vorname_1,);
		
				
				
		// vorname_2
		vorname_2 = new TextField();
		vorname_2.setImmediate(true);
		vorname_2.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_2.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					vorname_3.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		vorname_2.setWidth("32px"); //$NON-NLS-1$
		vorname_2.setHeight("-1px"); //$NON-NLS-1$
		vorname_2.setTabIndex(2);
		vorname_2.setMaxLength(1);
		vorname_2.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_2,
				"top:35.0px;left:117.0px;"); //$NON-NLS-1$
		
		// vorname_3
		vorname_3 = new TextField();
		vorname_3.setImmediate(true);
		vorname_3.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_3.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					vorname_4.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		vorname_3.setWidth("32px"); //$NON-NLS-1$
		vorname_3.setHeight("-1px"); //$NON-NLS-1$
		vorname_3.setTabIndex(3);
		vorname_3.setMaxLength(1);
		vorname_3.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_3,
				"top:35.0px;left:149.0px;"); //$NON-NLS-1$
		
		// vorname_4
		vorname_4 = new TextField();
		vorname_4.setImmediate(true);
		vorname_4.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_4.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					vorname_5.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		vorname_4.setWidth("32px"); //$NON-NLS-1$
		vorname_4.setHeight("-1px"); //$NON-NLS-1$
		vorname_4.setTabIndex(4);
		vorname_4.setMaxLength(1);
		vorname_4.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_4,
				"top:35.0px;left:179.0px;"); //$NON-NLS-1$
		
		// vorname_5
		vorname_5 = new TextField();
		vorname_5.setImmediate(true);
		vorname_5.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_5.addListener(new TextChangeListener(){
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					vorname_6.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		vorname_5.setWidth("32px"); //$NON-NLS-1$
		vorname_5.setHeight("-1px"); //$NON-NLS-1$
		vorname_5.setTabIndex(5);
		vorname_5.setMaxLength(1);
		vorname_5.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_5,
				"top:35.0px;left:211.0px;"); //$NON-NLS-1$
		
		// vorname_6
		vorname_6 = new TextField();
		vorname_6.setImmediate(true);
		vorname_6.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_6.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					vorname_7.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		vorname_6.setWidth("32px"); //$NON-NLS-1$
		vorname_6.setHeight("-1px"); //$NON-NLS-1$
		vorname_6.setTabIndex(6);
		vorname_6.setMaxLength(1);
		vorname_6.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_6,
				"top:35.0px;left:242.0px;"); //$NON-NLS-1$
		
		// vorname_7
		vorname_7 = new TextField();
		vorname_7.setImmediate(true);
		vorname_7.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_7.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					vorname_8.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		vorname_7.setWidth("32px"); //$NON-NLS-1$
		vorname_7.setHeight("-1px"); //$NON-NLS-1$
		vorname_7.setTabIndex(7);
		vorname_7.setMaxLength(1);
		vorname_7.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_7,
				"top:35.0px;left:273.0px;"); //$NON-NLS-1$
		
		// vorname_8
		vorname_8 = new TextField();
		vorname_8.setImmediate(true);
		vorname_8.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_8.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					vorname_9.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		vorname_8.setWidth("32px"); //$NON-NLS-1$
		vorname_8.setHeight("-1px"); //$NON-NLS-1$
		vorname_8.setTabIndex(8);
		vorname_8.setMaxLength(1);
		vorname_8.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_8,
				"top:35.0px;left:304.0px;"); //$NON-NLS-1$
		
		// vorname_9
		vorname_9 = new TextField();
		vorname_9.setImmediate(true);
		vorname_9.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_9.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					vorname_10.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		vorname_9.setWidth("32px"); //$NON-NLS-1$
		vorname_9.setHeight("-1px"); //$NON-NLS-1$
		vorname_9.setTabIndex(9);
		vorname_9.setMaxLength(1);
		vorname_9.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_9,
				"top:35.0px;left:336.0px;"); //$NON-NLS-1$
		
		// vorname_10
		vorname_10 = new TextField();
		vorname_10.setImmediate(true);
		vorname_10.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_10.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					vorname_11.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		vorname_10.setWidth("32px"); //$NON-NLS-1$
		vorname_10.setHeight("-1px"); //$NON-NLS-1$
		vorname_10.setTabIndex(10);
		vorname_10.setMaxLength(1);
		vorname_10.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_10,
				"top:35.0px;left:367.0px;"); //$NON-NLS-1$
		
		// vorname_11
		vorname_11 = new TextField();
		vorname_11.setImmediate(true);
		vorname_11.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_11.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					vorname_12.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		vorname_11.setWidth("32px"); //$NON-NLS-1$
		vorname_11.setHeight("-1px"); //$NON-NLS-1$
		vorname_11.setTabIndex(11);
		vorname_11.setMaxLength(1);
		vorname_11.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_11,
				"top:35.0px;left:397.0px;"); //$NON-NLS-1$
		
		// vorname_12
		vorname_12 = new TextField();
		vorname_12.setImmediate(true);
		vorname_12.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_12.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					vorname_13.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		vorname_12.setWidth("32px"); //$NON-NLS-1$
		vorname_12.setHeight("-1px"); //$NON-NLS-1$
		vorname_12.setTabIndex(12);
		vorname_12.setMaxLength(1);
		vorname_12.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_12,
				"top:35.0px;left:429.0px;"); //$NON-NLS-1$
		
		// vorname_13
		vorname_13 = new TextField();
		vorname_13.setImmediate(true);
		vorname_13.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_13.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					vorname_14.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		vorname_13.setWidth("32px"); //$NON-NLS-1$
		vorname_13.setHeight("-1px"); //$NON-NLS-1$
		vorname_13.setTabIndex(13);
		vorname_13.setMaxLength(1);
		vorname_13.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_13,
				"top:35.0px;left:461.0px;"); //$NON-NLS-1$
		
		// vorname_14
		vorname_14 = new TextField();
		vorname_14.setImmediate(true);
		vorname_14.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_14.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					vorname_15.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		vorname_14.setWidth("32px"); //$NON-NLS-1$
		vorname_14.setHeight("-1px"); //$NON-NLS-1$
		vorname_14.setTabIndex(14);
		vorname_14.setMaxLength(1);
		vorname_14.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_14,
				"top:35.0px;left:492.0px;"); //$NON-NLS-1$
		
		// vorname_15
		vorname_15 = new TextField();
		vorname_15.setImmediate(true);
		vorname_15.setTextChangeEventMode(TextChangeEventMode.EAGER);
		vorname_15.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_1.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		vorname_15.setWidth("32px"); //$NON-NLS-1$
		vorname_15.setHeight("-1px"); //$NON-NLS-1$
		vorname_15.setTabIndex(15);
		vorname_15.setMaxLength(1);
		vorname_15.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(vorname_15,
				"top:35.0px;left:523.0px;"); //$NON-NLS-1$
		
		//nameLabel
		nameLabel = new Label();
		nameLabel.setCaption(this.messages.getString("Name")); //$NON-NLS-1$
		nameLabel.setWidth("15px"); //$NON-NLS-1$
		formAbsoluteLayout.addComponent(nameLabel, 
				"top:94.0px;left:10.0px;"); //$NON-NLS-1$
		// name_1
		name_1 = new TextField();
		//name_1.setCaption("Nom");
		name_1.setImmediate(true);
		name_1.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_1.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_2.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_1.setWidth("32px"); //$NON-NLS-1$
		name_1.setHeight("-1px"); //$NON-NLS-1$
		name_1.setTabIndex(16);
		name_1.setMaxLength(1);
		name_1.addValidator(letterEntryValidator);
		formAbsoluteLayout
				.addComponent(name_1, "top:79.0px;left:87.0px;"); //$NON-NLS-1$
		
		// name_2
		name_2 = new TextField();
		name_2.setImmediate(true);
		name_2.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_2.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_3.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_2.setWidth("32px"); //$NON-NLS-1$
		name_2.setHeight("-1px"); //$NON-NLS-1$
		name_2.setTabIndex(17);
		name_2.setMaxLength(1);
		name_2.addValidator(letterEntryValidator);
		formAbsoluteLayout
				.addComponent(name_2, "top:79.0px;left:117.0px;"); //$NON-NLS-1$
		
		// name_3
		name_3 = new TextField();
		name_3.setImmediate(true);
		name_3.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_3.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_4.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_3.setWidth("32px"); //$NON-NLS-1$
		name_3.setHeight("-1px"); //$NON-NLS-1$
		name_3.setTabIndex(18);
		name_3.setMaxLength(1);
		name_3.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(name_3,
				"top:79.0px;left:149.0px;"); //$NON-NLS-1$
		
		// name_4
		name_4 = new TextField();
		name_4.setImmediate(true);
		name_4.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_4.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_5.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_4.setWidth("32px"); //$NON-NLS-1$
		name_4.setHeight("-1px"); //$NON-NLS-1$
		name_4.setTabIndex(19);
		name_4.setMaxLength(1);
		name_4.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(name_4,
				"top:79.0px;left:179.0px;"); //$NON-NLS-1$
		
		// name_5
		name_5 = new TextField();
		name_5.setImmediate(true);
		name_5.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_5.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_6.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_5.setWidth("32px"); //$NON-NLS-1$
		name_5.setHeight("-1px"); //$NON-NLS-1$
		name_5.setTabIndex(20);
		name_5.setMaxLength(1);
		name_5.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(name_5,
				"top:79.0px;left:211.0px;"); //$NON-NLS-1$
		
		// name_6
		name_6 = new TextField();
		name_6.setImmediate(true);
		name_6.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_6.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_7.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_6.setWidth("32px"); //$NON-NLS-1$
		name_6.setHeight("-1px"); //$NON-NLS-1$
		name_6.setTabIndex(21);
		name_6.setMaxLength(1);
		name_6.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(name_6,
				"top:79.0px;left:242.0px;"); //$NON-NLS-1$
		
		// name_7
		name_7 = new TextField();
		name_7.setImmediate(true);
		name_7.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_7.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_8.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_7.setWidth("32px"); //$NON-NLS-1$
		name_7.setHeight("-1px"); //$NON-NLS-1$
		name_7.setTabIndex(22);
		name_7.setMaxLength(1);
		name_7.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(name_7,
				"top:79.0px;left:273.0px;"); //$NON-NLS-1$
		
		// name_8
		name_8 = new TextField();
		name_8.setImmediate(true);
		name_8.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_8.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_9.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_8.setWidth("32px"); //$NON-NLS-1$
		name_8.setHeight("-1px"); //$NON-NLS-1$
		name_8.setTabIndex(23);
		name_8.setMaxLength(1);
		name_8.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(name_8,
				"top:79.0px;left:304.0px;"); //$NON-NLS-1$
		
		// name_9
		name_9 = new TextField();
		name_9.setImmediate(true);
		name_9.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_9.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_10.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_9.setWidth("32px"); //$NON-NLS-1$
		name_9.setHeight("-1px"); //$NON-NLS-1$
		name_9.setTabIndex(24);
		name_9.setMaxLength(1);
		name_9.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(name_9,
				"top:79.0px;left:336.0px;;"); //$NON-NLS-1$
		
		// name_10
		name_10 = new TextField();
		name_10.setImmediate(true);
		name_10.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_10.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_11.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_10.setWidth("32px"); //$NON-NLS-1$
		name_10.setHeight("-1px"); //$NON-NLS-1$
		name_10.setTabIndex(25);
		name_10.setMaxLength(1);
		name_10.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(name_10,
				"top:79.0px;left:367.0px;"); //$NON-NLS-1$
		
		// name_11
		name_11 = new TextField();
		name_11.setImmediate(true);
		name_11.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_11.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_12.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_11.setWidth("32px"); //$NON-NLS-1$
		name_11.setHeight("-1px"); //$NON-NLS-1$
		name_11.setTabIndex(26);
		name_11.setMaxLength(1);
		name_11.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(name_11,
				"top:79.0px;left:397.0px;"); //$NON-NLS-1$
		
		// name_12
		name_12 = new TextField();
		name_12.setImmediate(true);
		name_12.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_12.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_13.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_12.setWidth("32px"); //$NON-NLS-1$
		name_12.setHeight("-1px"); //$NON-NLS-1$
		name_12.setTabIndex(27);
		name_12.setMaxLength(1);
		name_12.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(name_12,
				"top:79.0px;left:429.0px;"); //$NON-NLS-1$
		
		// name_13
		name_13 = new TextField();
		name_13.setImmediate(true);
		name_13.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_13.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_14.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_13.setWidth("32px"); //$NON-NLS-1$
		name_13.setHeight("-1px"); //$NON-NLS-1$
		name_13.setTabIndex(28);
		name_13.setMaxLength(1);
		name_13.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(name_13,
				"top:79.0px;left:461.0px;"); //$NON-NLS-1$
		
		// name_14
		name_14 = new TextField();
		name_14.setImmediate(true);
		name_14.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_14.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					name_15.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_14.setWidth("32px"); //$NON-NLS-1$
		name_14.setHeight("-1px"); //$NON-NLS-1$
		name_14.setTabIndex(29);
		name_14.setMaxLength(1);
		name_14.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(name_14,
				"top:79.0px;left:492.0px;"); //$NON-NLS-1$
		
		// name_15
		name_15 = new TextField();
		name_15.setImmediate(true);
		name_15.setTextChangeEventMode(TextChangeEventMode.EAGER);
		name_15.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					day_1.focus();
				}
				if(event.getText().length()==0){
					event.getComponent().setCaption("");
					event.getComponent().requestRepaint();
				}
			}
		});
		name_15.setWidth("32px"); //$NON-NLS-1$
		name_15.setHeight("-1px"); //$NON-NLS-1$
		name_15.setTabIndex(30);
		name_15.setMaxLength(1);
		name_15.addValidator(letterEntryValidator);
		formAbsoluteLayout.addComponent(name_15,
				"top:79.0px;left:523.0px;"); //$NON-NLS-1$
		
		//dateLabel
		dateLabel = new Label();
		dateLabel.setCaption(this.messages.getString("birthdate")); //$NON-NLS-1$
		dateLabel.setWidth("15px"); //$NON-NLS-1$
		formAbsoluteLayout.addComponent(dateLabel, 
				"top:141.0px;left:10.0px;"); //$NON-NLS-1$
		//day_1
		day_1 = new TextField();
		day_1.setCaption(this.messages.getString("day"));
		day_1.setImmediate(true);
		day_1.setTextChangeEventMode(TextChangeEventMode.EAGER);
		day_1.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					day_2.focus();
				}
			}
		});
		day_1.setWidth("32px"); //$NON-NLS-1$
		day_1.setHeight("-1px"); //$NON-NLS-1$
		day_1.addValidator(numericEntryValidator);
		day_1.setTabIndex(31);
		day_1.setMaxLength(1);
		day_1.setRequired(true);
		formAbsoluteLayout.addComponent(day_1, 
				"top:126.0px;left:151.0px;"); //$NON-NLS-1$
	
		//day_2
		day_2 = new TextField();
		day_2.setCaption(this.messages.getString("day"));
		day_2.setImmediate(true);
		day_2.setTextChangeEventMode(TextChangeEventMode.EAGER);
		day_2.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					month_1.focus();
				}
			}
		});
		day_2.setWidth("32px"); //$NON-NLS-1$
		day_2.setHeight("-1px"); //$NON-NLS-1$
		day_2.addValidator(numericEntryValidator);
		day_2.setTabIndex(32);
		day_2.setMaxLength(1);
		day_2.setRequired(true);
		formAbsoluteLayout.addComponent(day_2, 
				"top:126.0px;left:181.0px;"); //$NON-NLS-1$
		
		//month_1
		month_1 = new TextField();
		month_1.setCaption(this.messages.getString("month"));
		month_1.setImmediate(true);
		month_1.setTextChangeEventMode(TextChangeEventMode.EAGER);
		month_1.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					month_2.focus();
				}
			}
		});
		month_1.setWidth("32px"); //$NON-NLS-1$
		month_1.setHeight("-1px"); //$NON-NLS-1$
		month_1.addValidator(numericEntryValidator);
		month_1.setTabIndex(33);
		month_1.setMaxLength(1);
		month_1.setRequired(true);
		formAbsoluteLayout.addComponent(month_1, 
				"top:126.0px;left:244.0px;"); //$NON-NLS-1$
		//month_2
		month_2 = new TextField();
		month_2.setCaption(this.messages.getString("month"));
		month_2.setImmediate(true);
		month_2.setTextChangeEventMode(TextChangeEventMode.EAGER);
		month_2.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					year_1.focus();
				}
			}
		});
		month_2.setWidth("32px"); //$NON-NLS-1$
		month_2.setHeight("-1px"); //$NON-NLS-1$
		month_2.addValidator(numericEntryValidator);
		month_2.setMaxLength(1);
		month_2.setRequired(true);
		month_2.setTabIndex(34);
		formAbsoluteLayout.addComponent(month_2, 
				"top:126.0px;left:275.0px;"); //$NON-NLS-1$
		//year_1
		year_1 = new TextField();
		year_1.setCaption(this.messages.getString("year"));
		year_1.setImmediate(true);
		year_1.setTextChangeEventMode(TextChangeEventMode.EAGER);
		year_1.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					year_2.focus();
				}
			}
		});
		year_1.setWidth("32px"); //$NON-NLS-1$
		year_1.setHeight("-1px"); //$NON-NLS-1$
		year_1.addValidator(numericEntryValidator);
		year_1.setTabIndex(35);
		year_1.setMaxLength(1);
		year_1.setRequired(true);
		formAbsoluteLayout.addComponent(year_1, 
				"top:126.0px;left:339.0px;"); //$NON-NLS-1$
		//year_2
		year_2 = new TextField();
		year_2.setCaption(this.messages.getString("year"));
		year_2.setImmediate(true);
		year_2.setTextChangeEventMode(TextChangeEventMode.EAGER);
		year_2.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					year_3.focus();
				}
			}
		});
		year_2.setWidth("32px"); //$NON-NLS-1$
		year_2.setHeight("-1px"); //$NON-NLS-1$
		year_2.addValidator(numericEntryValidator);
		year_2.setTabIndex(36);
		year_2.setMaxLength(1);
		year_2.setRequired(true);
		formAbsoluteLayout.addComponent(year_2, 
				"top:126.0px;left:370.0px;"); //$NON-NLS-1$
		//year_3
		year_3 = new TextField();
		year_3.setCaption(this.messages.getString("year"));
		year_3.setImmediate(true);
		year_3.setTextChangeEventMode(TextChangeEventMode.EAGER);
		year_3.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					year_4.focus();
				}
			}
		});
		year_3.setWidth("32px"); //$NON-NLS-1$
		year_3.setHeight("-1px"); //$NON-NLS-1$
		year_3.addValidator(numericEntryValidator);
		year_3.setTabIndex(37);
		year_3.setMaxLength(1);
		year_3.setRequired(true);
		formAbsoluteLayout.addComponent(year_3, 
				"top:126.0px;left:401.0px;"); //$NON-NLS-1$
		//year_4
		year_4 = new TextField();
		year_4.setCaption(this.messages.getString("year"));
		year_4.setImmediate(true);
		year_4.setTextChangeEventMode(TextChangeEventMode.EAGER);
		year_4.addListener(new TextChangeListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void textChange(TextChangeEvent event) {
				// TODO Auto-generated method stub
				if(event.getText().length()>0){
					sendButton.focus();
				}
			}
		});
		year_4.setWidth("32px"); //$NON-NLS-1$
		year_4.setHeight("-1px"); //$NON-NLS-1$
		year_4.addValidator(numericEntryValidator);
		year_4.setTabIndex(38);
		year_4.setMaxLength(1);
		year_4.setRequired(true);
		formAbsoluteLayout.addComponent(year_4, 
						"top:126.0px;left:433.0px;"); //$NON-NLS-1$
		//sendButton
		sendButton =  new Button();
		sendButton.setTabIndex(39);
		sendButton.setCaption(this.messages.getString("send"));
		sendButton.setDescription(this.messages.getString("send"));
		sendButton.setHeight("30px"); 
		sendButton.setWidth("90px"); 
		formAbsoluteLayout.addComponent(sendButton,
				"top:160.0px;left:463.0px;"); //$NON-NLS-1$
		sendButtonListener = new ClickListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void buttonClick(ClickEvent event) {
				// TODO Auto-generated method stub
				moreButton.setEnabled(true);
				try{
					List<String> namesValues = new ArrayList<String>(
							Arrays.asList(name_1.getValue().toString(),
									name_2.getValue().toString(),
									name_3.getValue().toString(),
									name_4.getValue().toString(),
									name_5.getValue().toString(),
									name_6.getValue().toString(),
									name_7.getValue().toString(),
									name_8.getValue().toString(),
									name_9.getValue().toString(),
									name_10.getValue().toString(),
									name_11.getValue().toString(),
									name_12.getValue().toString(),
									name_13.getValue().toString(),
									name_14.getValue().toString(),
									name_15.getValue().toString()
									));
					//System.out.println(namesValues);
					List<String> firstnamesValues = new ArrayList<String>(
							Arrays.asList(vorname_1.getValue().toString(),
									vorname_2.getValue().toString(),
									vorname_3.getValue().toString(),
									vorname_4.getValue().toString(),
									vorname_5.getValue().toString(),
									vorname_6.getValue().toString(),
									vorname_7.getValue().toString(),
									vorname_8.getValue().toString(),
									vorname_9.getValue().toString(),
									vorname_10.getValue().toString(),
									vorname_11.getValue().toString(),
									vorname_12.getValue().toString(),
									vorname_13.getValue().toString(),
									vorname_14.getValue().toString(),
									vorname_15.getValue().toString()
									));
					
					//System.out.println(firstnamesValues);
					doNormalizeBirthDate();
					List<Integer> dateOfBirth = new ArrayList<Integer>(
							Arrays.asList(Integer.parseInt(day_1.getValue().toString()),
									Integer.parseInt(day_2.getValue().toString()),
									Integer.parseInt(month_1.getValue().toString()),
									Integer.parseInt(month_2.getValue().toString()),
									Integer.parseInt(year_1.getValue().toString()),
									Integer.parseInt(year_2.getValue().toString()),
									Integer.parseInt(year_3.getValue().toString()),
									Integer.parseInt(year_4.getValue().toString())
							));
					//discardButton.setLocale(new Locale("fr","FR"));
					individum.setIdentityValues(firstnamesValues, namesValues, dateOfBirth);
					//set the language of the individum
					individum.setLanguageCode(getLanguageCode());
					//initialize the data of the individum
					individum.init();
					individum.computeNombreAbscents();
					individum.computeNombresEnExces();
					individum.computeNombreDominants();
					individum.computeNombreActif();
					individum.computeNombreHereditaire();
					individum.computeNombreIntime();
					individum.computeNombreDesInitiales();
					individum.computeNombreDeRealisation();
					individum.computeNombreDExpression();
					individum.computeCheminDeVie();
					individum.computeNombreUnique();
					individum.computeAnneePersonnelle();
					individum.computeNombreMoisPersonnelle();
					individum.computeNombreJourPersonnel();
					
					
					//set the identity values for the result form
					feuilleDeResultat.setFirstNames(individum.getFirstNames());
					feuilleDeResultat.setNames(individum.getNames());
					feuilleDeResultat.setBirthDateAsString(individum.getBirthDateAsString());
					//set the result of the calculation
					feuilleDeResultat.setTableDeResultat(individum.getNombreActif(), 
							individum.getNombreHereditaire(), individum.getNombreDExpression(), 
							individum.getNombreIntime(), individum.getNombreDeRealisation(),
							individum.getNombreDesInitiales(), individum.getCheminDeVie(),
							individum.getNombreUnique(),
							(ArrayList<Integer>)individum.getNombreAbscents(), 
							(ArrayList<Integer>)individum.getNombreDominants(),
							(ArrayList<Integer>)individum.getNombresEnExces(),
							individum.getAnneePersonnelle(),
							individum.getMoisPersonnel(),
							individum.getJourPersonnel());
					
					//occurenceTableUI
					occurenceTableUI.setOccurenceTableValues(individum.getOccurenceTable());
					
					//resize the window
					Map <Component,Map<String,String>> componentsToResize = new HashMap<Component, Map<String,String>>();
					Map <String,String> newDimensionsFormLayout= new HashMap<String,String>();
					newDimensionsFormLayout.put("620.0px", "510.0px");
					componentsToResize.put(formAbsoluteLayout, newDimensionsFormLayout);
					
					Map <String,String> newDimensionsForm = new HashMap<String,String>();
					newDimensionsForm.put("630.0px", "530.0px");
					componentsToResize.put(feuilleForm, newDimensionsForm);
					
					Map <String,String> NewDimensionsMainPanelAbsoluteLayout = new HashMap<String,String>();
					NewDimensionsMainPanelAbsoluteLayout.put("645.0px", "540px");
					componentsToResize.put(mainPanelAbsoluteLayout, NewDimensionsMainPanelAbsoluteLayout);
					
					Map <String,String> NewDimensionsMainPanel = new HashMap<String,String>();
					NewDimensionsMainPanel.put("650px", "570px");
					componentsToResize.put(mainPanel, NewDimensionsMainPanel);
					
					resizeComponents(componentsToResize);
					
					
				}catch (Exception e) {
					// TODO: handle exception
					System.out.println("Error: Empty date " + e.getMessage());
				}
				
				//enable the buttons
				enableComponents();
			}
		};
		sendButton.addListener(sendButtonListener);
		
		//feuille de résultat
		formAbsoluteLayout.addComponent(feuilleDeResultat, 
				"top:226.0px;left:60.0px;");

		//discardButton
		discardButton =  new Button(this.messages.getString("discard")); 
		discardButton.setDescription(this.messages.getString("discard"));
		discardButton.setTabIndex(40);
		discardButton.setHeight("30px"); //$NON-NLS-1$
		discardButton.setWidth("90px"); //$NON-NLS-1$
		formAbsoluteLayout.addComponent(discardButton,
				"top:160.0px;left:368.0px;"); //$NON-NLS-1$
		discardButtonListner = new ClickListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void buttonClick(ClickEvent event) {
				// TODO Auto-generated method stub
				feuilleDeResultat.resetTableDeResultat();
			}
		};
		discardButton.addListener(discardButtonListner);
		
		//vertical bar
		Label verticalBar = new Label();
		verticalBar.addStyleName("vertical-separator");
		verticalBar.setWidth("1px");
		formAbsoluteLayout.addComponent(verticalBar, "top:20.0px;left:575.0px;");
		
		// moreButton
		moreButton = new Button();
		moreButton.setStyleName(BaseTheme.BUTTON_LINK);
		//moreButton.setCaption(Messages.getString(LOCALEBASE + getCurrentLocaleValue() +"."+ LOCALEPROPSTRING 
		//						+".moreButtonCapt"));
		moreButton.setDescription(this.messages.getString("moreButtonDesc"));
		moreButton.setIcon(new ThemeResource("img/zoom.png"));
		moreButton.setImmediate(true);
		formAbsoluteLayout.addComponent(moreButton, 
						"top:20.0px;left:585.0px;");
		moreButtonListener = new ClickListener() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public void buttonClick(ClickEvent event) {
				// TODO Auto-generated method stub
				
				setComponentVisibility(occurenceTableCaption, true);
				setComponentVisibility(occurenceTableUI, true);
				
				//resize the window
				Map <Component,Map<String,String>> componentsToResize = new HashMap<Component, Map<String,String>>();
				Map <String,String> newDimensionsFormLayout= new HashMap<String,String>();
				newDimensionsFormLayout.put("620.0px", "840.0px");
				componentsToResize.put(formAbsoluteLayout, newDimensionsFormLayout);
				
				Map <String,String> newDimensionsForm = new HashMap<String,String>();
				newDimensionsForm.put("630.0px", "860.0px");
				componentsToResize.put(feuilleForm, newDimensionsForm);
				
				Map <String,String> NewDimensionsMainPanelAbsoluteLayout = new HashMap<String,String>();
				NewDimensionsMainPanelAbsoluteLayout.put("645.0px", "870px");
				componentsToResize.put(mainPanelAbsoluteLayout, NewDimensionsMainPanelAbsoluteLayout);
				
				Map <String,String> NewDimensionsMainPanel = new HashMap<String,String>();
				NewDimensionsMainPanel.put("650px", "900px");
				componentsToResize.put(mainPanel, NewDimensionsMainPanel);
				
				resizeComponents(componentsToResize);
				
				showMiseEnNombre();
			}
		};
		moreButton.addListener(moreButtonListener);
		//moreButtonSeparator
		HorizontalBar moreButtonSeparator = new HorizontalBar();
		moreButtonSeparator.setStyleName();
		moreButtonSeparator.setWidth("50.0px");
		formAbsoluteLayout.addComponent(moreButtonSeparator, 
				"top:60.0px;left:575.0px;");
		//mailButton
		mailButton = new Button();
		mailButton.setStyleName(BaseTheme.BUTTON_LINK);
		//mailButton.setCaption("senden");
		mailButton.setDescription(this.messages.getString("mailButtonDesc"));
		mailButton.setIcon(new ThemeResource("img/mail.jpg"));
		mailButton.setImmediate(true);
		formAbsoluteLayout.addComponent(mailButton, 
				"top:67.0px;left:585.0px;");
		//mailButtonSeparator
		HorizontalBar mailButtonSeparator = new HorizontalBar();
		mailButtonSeparator.setStyleName();
		mailButtonSeparator.setWidth("50.0px");
		formAbsoluteLayout.addComponent(mailButtonSeparator, 
				"top:100.0px;left:575.0px;");
		//printerButton
		printerButton = new Button();
		printerButton.setStyleName(BaseTheme.BUTTON_LINK);
		printerButton.setDescription("Print");
		//printerButton.setCaption("Drucken");
		printerButton.setIcon(new ThemeResource("img/print.png"));
		formAbsoluteLayout.addComponent(printerButton, 
				"top:105.0px;left:585.0px;");
		printButtonListener = new ClickListener() {
			
			@Override
			public void buttonClick(ClickEvent event) {
				// TODO Auto-generated method stub
				printerButton.getWindow().executeJavaScript("print();");
			}
		};
		printerButton.addListener(printButtonListener);
		//mailButtonSeparator
		HorizontalBar printerButtonSeparator = new HorizontalBar();
		printerButtonSeparator.setStyleName();
		printerButtonSeparator.setWidth("50.0px");
		formAbsoluteLayout.addComponent(printerButtonSeparator, 
				"top:140.0px;left:575.0px;");
		//secondVertical bar
		Label secondVerticalBar = new Label();
		secondVerticalBar.addStyleName("vertical-separator");
		secondVerticalBar.setWidth("1px");
		formAbsoluteLayout.addComponent(secondVerticalBar, "top:20.0px;left:619.0px;");
		
		
		//horizontal bar
		horizontalBar = new Label();
		horizontalBar.setStyleName("horizontal-separator");
		horizontalBar.setHeight("1px");
		formAbsoluteLayout.addComponent(horizontalBar, 
				"top:495.0px;left:0.0px;");
		
		//secondHorizontalBar 
		HorizontalBar secondHorizontalBar = new HorizontalBar();
		secondHorizontalBar.setStyleName();
		formAbsoluteLayout.addComponent(secondHorizontalBar, "top:200.0px;left:0.0px;");
		
		//occurenceTableCaption
		occurenceTableCaption = new Label();
		occurenceTableCaption.setContentMode(Label.CONTENT_RAW);
		occurenceTableCaption.setValue("<br>"+ this.messages.getString("occurenceTableCaption") +"</br>");
		formAbsoluteLayout.addComponent(occurenceTableCaption,
				"top:490.0px;left:350.0px;");
		occurenceTableCaption.setVisible(false);
		
		//occurenceTableUI
		occurenceTableUI = new OccurenceTableUI();
		formAbsoluteLayout.addComponent(occurenceTableUI, 
				"top:535.0px;left:350.0px;");
		occurenceTableUI.setVisible(false);
		
		//IdentityComponent
		//IdentityComponentUI myComponent = new IdentityComponentUI(getCurrentLocaleValue(),mainWindow);
		//formAbsoluteLayout.addComponent(myComponent, 
			//	"top:750.0px;left:10.0px;");
		
		disableComponents();
		return formAbsoluteLayout;
	}
	
	public void setComponentVisibility(Component component, boolean visible){
		//formAbsoluteLayout.getWindow().get
		component.setVisible(visible);
		component.getParent().requestRepaint();
		component.requestRepaint();
	}

	
	public void doNormalizeBirthDate(){
		if(day_1.getValue() == null | day_1.getValue() == ""){
			day_1.setValue("0");
		}
		if(day_2.getValue() == null | day_2.getValue() == ""){
			day_2.setValue("1");
		}
		if(month_1.getValue() == null | month_1.getValue() == ""){
			month_1.setValue("0");
		}
		if(month_2.getValue() == null | month_2.getValue() == ""){
			month_2.setValue("1");
		}
		if(year_1.getValue() == null | year_1.getValue() == ""){
			year_1.setValue("1");
		}
		if(year_2.getValue() == null | year_2.getValue() == ""){
			year_2.setValue("9");
		}
		if(year_3.getValue() == null | year_3.getValue() == ""){
			year_3.setValue("7");
		}
		if(year_4.getValue() == null | year_4.getValue() == ""){
			year_4.setValue("0");
		}
	}
	/**
	 * 
	 */
	public void disableComponents(){
		moreButton.setEnabled(false);
		mailButton.setEnabled(false);
		printerButton.setEnabled(false);
	}
	/**
	 * 
	 */
	public void enableComponents(){
		moreButton.setEnabled(true);
		mailButton.setEnabled(true);
		printerButton.setEnabled(true);
	}
	/**
	 * Cette methode recoit une liste de Componsants auquels sont attribués
	 * un couplet (lageur,hauteur) qui constitue les nouvelles dimensions
	 * qu'elle attribue à chacun des composants.
	 * @param newComponentDims
	 */
	public void resizeComponents(Map <Component, Map<String,String>> newComponentDims){
		
		for(Map.Entry<Component, Map<String,String>> aComponent : newComponentDims.entrySet()){
			Component theComponent = aComponent.getKey();
			Map <String,String> newDimensions = aComponent.getValue();
			System.out.println("Component " + theComponent);
			for(Map.Entry<String, String> aDimensionSet : newDimensions.entrySet()){
				String width = aDimensionSet.getKey();
				String height= aDimensionSet.getValue();
				theComponent.setWidth(width);
				theComponent.setHeight(height);
				System.out.println("W:H " + width +"|" + height);
			}
			theComponent.requestRepaint();
		}
		
	}
	public void showMiseEnNombre(){
	
		name_1.setCaption( individum.getNameLettersMapping().get(0)==0 ? "" :  String.valueOf(individum.getNameLettersMapping().get(0)));
		name_2.setCaption(individum.getNameLettersMapping().get(1)==0 ? "" :   String.valueOf(individum.getNameLettersMapping().get(1)));
		name_3.setCaption(individum.getNameLettersMapping().get(2)==0 ? "" :   String.valueOf(individum.getNameLettersMapping().get(2)));
		name_4.setCaption(individum.getNameLettersMapping().get(3)==0 ? "" : String.valueOf(individum.getNameLettersMapping().get(3)));
		name_5.setCaption(individum.getNameLettersMapping().get(4)==0 ? "" : String.valueOf(individum.getNameLettersMapping().get(4)));
		name_6.setCaption(individum.getNameLettersMapping().get(5)==0 ? "" : String.valueOf(individum.getNameLettersMapping().get(5)));
		name_7.setCaption(individum.getNameLettersMapping().get(6)==0 ? "" : String.valueOf(individum.getNameLettersMapping().get(6)));
		name_8.setCaption(individum.getNameLettersMapping().get(7)==0 ? "" : String.valueOf(individum.getNameLettersMapping().get(7)));
		name_9.setCaption(individum.getNameLettersMapping().get(8)==0 ? "" : String.valueOf(individum.getNameLettersMapping().get(8)));
		name_10.setCaption(individum.getNameLettersMapping().get(9)==0 ? "" : String.valueOf(individum.getNameLettersMapping().get(9)));
		name_11.setCaption(individum.getNameLettersMapping().get(10)==0 ? "" : String.valueOf(individum.getNameLettersMapping().get(10)));
		name_12.setCaption(individum.getNameLettersMapping().get(11)==0 ? "" : String.valueOf(individum.getNameLettersMapping().get(11)));
		name_13.setCaption(individum.getNameLettersMapping().get(12)==0 ? "" : String.valueOf(individum.getNameLettersMapping().get(12)));
		name_14.setCaption(individum.getNameLettersMapping().get(13)==0 ? "" : String.valueOf(individum.getNameLettersMapping().get(13)));
		name_15.setCaption(individum.getNameLettersMapping().get(14)==0 ? "" : String.valueOf(individum.getNameLettersMapping().get(14)));
		
		vorname_1.setCaption(individum.getFirstnameLettersMapping().get(0)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(0)));
		vorname_2.setCaption(individum.getFirstnameLettersMapping().get(1)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(1)));
		vorname_3.setCaption(individum.getFirstnameLettersMapping().get(2)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(2)));
		vorname_4.setCaption(individum.getFirstnameLettersMapping().get(3)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(3)));
		vorname_5.setCaption(individum.getFirstnameLettersMapping().get(4)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(4)));
		vorname_6.setCaption(individum.getFirstnameLettersMapping().get(5)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(5)));
		vorname_7.setCaption(individum.getFirstnameLettersMapping().get(6)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(6)));
		vorname_8.setCaption(individum.getFirstnameLettersMapping().get(7)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(7)));
		vorname_9.setCaption(individum.getFirstnameLettersMapping().get(8)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(8)));
		vorname_10.setCaption(individum.getFirstnameLettersMapping().get(9)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(9)));
		vorname_11.setCaption(individum.getFirstnameLettersMapping().get(10)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(10)));
		vorname_12.setCaption(individum.getFirstnameLettersMapping().get(11)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(11)));
		vorname_13.setCaption(individum.getFirstnameLettersMapping().get(12)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(12)));
		vorname_14.setCaption(individum.getFirstnameLettersMapping().get(13)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(13)));
		vorname_15.setCaption(individum.getFirstnameLettersMapping().get(14)==0 ? "" : String.valueOf(individum.getFirstnameLettersMapping().get(14)));

	}
}
